var t = require("../../../../../../@babel/runtime/helpers/defineProperty"), e = getApp();

Component({
    properties: {
        goodsList: {
            type: Array,
            value: []
        }
    },
    data: {
        popShow: !1,
        returnGoodsModels: []
    },
    methods: {
        setPopShow: function() {
            this.setData({
                popShow: !this.data.popShow
            });
        },
        onChange: function(t) {
            this.setData({
                returnGoodsModels: t.detail
            });
        },
        sendBtn: function() {
            var t = this;
            if (this.data.returnGoodsModels.length < 1) return e.tips("请选择商品");
            var o = [], s = 0;
            console.log(this.data.goodsList), this.data.goodsList.forEach(function(e) {
                if (-1 != t.data.returnGoodsModels.indexOf(e.id + "")) {
                    var i = {};
                    i.goods_thumb = e.thumb, i.goods_title = e.title, i.refund_total = e.stepperValue, 
                    i.id = e.id, i.goods_option_title = e.goods_option_title, i.refund_price = e.unit_price * e.stepperValue, 
                    s += i.refund_price, o.push(i);
                }
            }), this.triggerEvent("confirm", {
                modelsArr: o,
                total_price: s
            }), this.setPopShow();
        },
        changeStepperValue: function(e) {
            var o = e.currentTarget.dataset.index, s = e.detail;
            this.setData(t({}, "goodsList[".concat(o, "].stepperValue"), s));
        }
    }
});